<template>
  <div class="similar">
    <div class="title">相似推荐</div>
    <div class="content">
      <div
        class="goods_card"
        v-for="item in this.goodsList"
        :key="item.id"
      >
        <div class="goods_img">
          <img
            :src="item.s_goods_photos[0].path"
            alt=""
          >
        </div>
        <div class="goods_text">
          <div class="goods_title">
            <p>{{item.name}}</p>
          </div>
          <div class="coupons">
            <span>满300减30</span>
            <span>店铺领券</span>
          </div>
          <div class="price">
            {{"¥ "+item.price}}
          </div>
        </div>

      </div>
    </div>

  </div>
</template>

<script>
import { mapState } from 'vuex'

export default {
  computed: {
    ...mapState(['goodsList']),
  }
}
</script>

<style lang="scss" scoped>
.similar {
  height: 880px;
  padding: 10px;
  background-color: #b09c88;
  margin-bottom: 70px;
  .title {
    font-weight: 700;
    font-size: 16px;
  }
  .content {
    height: 807px;
    margin-top: 25px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-content: space-between;
    .goods_card {
      width: 165px;
      height: 259px;
      border-radius: 5px;
      background-color: #fff;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      box-shadow: rgba(60, 64, 67, 0.3) 0px 1px 2px 0px,
        rgba(60, 64, 67, 0.15) 0px 2px 6px 2px;
      .goods_img {
        width: 165px;
        height: 165px;
        border-radius: 5px 5px 0 0;
        overflow: hidden;
        img {
          width: 100%;
          height: 100%;
        }
      }
      .goods_text {
        width: 100%;
        height: 94px;
        padding: 10px;
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        .goods_title {
          height: 40px;
          font-weight: 400;
          font-size: 14px;
          line-height: 16px;
          overflow: hidden;
          p {
            /* 超出范围隐藏 */
            overflow: hidden;
            /* 文字超出用省略号 */
            text-overflow: ellipsis;
            /* 盒子模型 */
            display: -webkit-box;
            /* 显示的文本行数 */
            -webkit-line-clamp: 2;
            /* 子元素的垂直排列方式 */
            -webkit-box-orient: vertical;
          }
        }
        .coupons {
          width: 130px;

          span {
            display: inline-block;
            width: 62px;
            font-weight: 400;
            font-size: 12px;
            color: #8e7e6f;
            text-align: center;
            border: 1px solid #8e7e6f;
            &:nth-child(1) {
              border-right: 1px dashed;
              border-radius: 0 5px 5px 0;
            }
            &:nth-child(2) {
              border-left: 0px dashed;
              border-radius: 5px 0 0 5px;
            }
          }
        }
        .price {
          font-weight: 700;
          font-size: 14px;
          text-align: left;
          line-height: 16px;
        }
      }
    }
  }
}
</style>